﻿@model List<Retete.Models.Meniu>
@{
    ViewBag.Title = "Meniuri";
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "form", name = "form" }))
{
    <table style="width: 100%">
        <tr>
            <td style="width: 190px; vertical-align: top; border-right-style: dashed; border-right-color: #CFCFCF; border-right-width: 1px;">
                <fieldset>
                    <legend>Activitati</legend>

                    <p class="toolbox"><a href="javascript:form.submit()">Trimite mail</a></p>
                    <p class="toolbox">@Html.ActionLink("Renunta", "Index")</p>
                </fieldset>
            </td>
            <td style="vertical-align: top;">
                @Html.ValidationSummary(false)

                <fieldset>
                    <legend>Trimite mail la clienti</legend>

                    @for (int i = 0; i < Model.Count; i++)
                    {
                        @Html.HiddenFor(element => element[i].ID)

                        <table class="grid">
                            <thead>
                                <tr>
                                    <th style="width: 70px">Cod</th>
                                    <th>
                                        @{
                                            string numeZi = System.Globalization.CultureInfo.CreateSpecificCulture("ro-Ro").DateTimeFormat.DayNames[(int)Model[i].Valabilitate.Value.DayOfWeek].Replace('ţ', 't');
                                            <span>@(char.ToUpper(numeZi[0]) + numeZi.Substring(1))</span>
                                        }
                                    </th>
                                    <th style="width: 139px">Portii</th>
                                </tr>
                            </thead>

                            <tbody>
                                @for (int j = 0; j < Model[i].Retete.Count; j++)
                                {
                                    <tr>
                                        <td>@Model[i].Retete.Skip(j).First().Reteta.Cod</td>
                                        <td>@Model[i].Retete.Skip(j).First().Reteta.Nume</td>
                                        <td>@Model[i].Retete.Skip(j).First().Portii.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)</td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                        <br />
                    }
                </fieldset>
            </td>
        </tr>
    </table>
}